# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python


class Recipe(custom.GStreamer):
    name = 'gst-plugins-base-1.0'
    config_sh = 'sh ./autogen.sh --noconfigure && ./configure'
    configure_options = "--enable-static --program-prefix= --disable-examples "
    remotes = {'origin': 'git://anongit.freedesktop.org/gstreamer/gst-plugins-base'}
    commit = 'f996b056444164e72886451963649733a9ae013e'
    deps = ['glib', 'gstreamer-1.0', 'zlib', 'orc', 'opus']
    use_system_libs = True

    files_bins = ['gst-discoverer-1.0', 'gst-play-1.0', 'gst-device-monitor-1.0']

    files_libs = ['libgstallocators-1.0',
                 'libgstapp-1.0', 'libgstaudio-1.0',
                 'libgstfft-1.0', 'libgstpbutils-1.0', 'libgstriff-1.0', 'libgstrtp-1.0',
                 'libgstrtsp-1.0', 'libgstsdp-1.0', 'libgsttag-1.0',
                 'libgstvideo-1.0',]

    files_plugins_core = [
             'lib/gstreamer-1.0/libgstapp%(mext)s',
             'lib/gstreamer-1.0/libgstaudioconvert%(mext)s',
             'lib/gstreamer-1.0/libgstaudiorate%(mext)s',
             'lib/gstreamer-1.0/libgstaudioresample%(mext)s',
             'lib/gstreamer-1.0/libgstaudiotestsrc%(mext)s',
             'lib/gstreamer-1.0/libgsttypefindfunctions%(mext)s',
             'lib/gstreamer-1.0/libgstvideoconvert%(mext)s',
             'lib/gstreamer-1.0/libgstvideorate%(mext)s',
             'lib/gstreamer-1.0/libgstvideoscale%(mext)s',
             'lib/gstreamer-1.0/libgstvideotestsrc%(mext)s',
             'lib/gstreamer-1.0/libgstvolume%(mext)s',
    ]

    files_plugins_core_devel = [
             'lib/gstreamer-1.0/libgstapp.a', 'lib/gstreamer-1.0/libgstapp.la',
             'lib/gstreamer-1.0/libgstaudioconvert.a', 'lib/gstreamer-1.0/libgstaudioconvert.la',
             'lib/gstreamer-1.0/libgstaudiorate.a', 'lib/gstreamer-1.0/libgstaudiorate.la',
             'lib/gstreamer-1.0/libgstaudioresample.a', 'lib/gstreamer-1.0/libgstaudioresample.la',
             'lib/gstreamer-1.0/libgstaudiotestsrc.a', 'lib/gstreamer-1.0/libgstaudiotestsrc.la',
             'lib/gstreamer-1.0/libgsttypefindfunctions.a', 'lib/gstreamer-1.0/libgsttypefindfunctions.la',
             'lib/gstreamer-1.0/libgstvideoconvert.a', 'lib/gstreamer-1.0/libgstvideoconvert.la',
             'lib/gstreamer-1.0/libgstvideorate.a', 'lib/gstreamer-1.0/libgstvideorate.la',
             'lib/gstreamer-1.0/libgstvideoscale.a', 'lib/gstreamer-1.0/libgstvideoscale.la',
             'lib/gstreamer-1.0/libgstvideotestsrc.a', 'lib/gstreamer-1.0/libgstvideotestsrc.la',
             'lib/gstreamer-1.0/libgstvolume.a', 'lib/gstreamer-1.0/libgstvolume.la',
    ]

    files_plugins_codecs = [
             'lib/gstreamer-1.0/libgstopus%(mext)s',
    ]

    files_plugins_codecs_devel = [
             'lib/gstreamer-1.0/libgstopus.a', 'lib/gstreamer-1.0/libgstopus.la',
    ]

    files_plugins_devel = [
            'include/gstreamer-1.0/gst/allocators',
            'include/gstreamer-1.0/gst/app',
            'include/gstreamer-1.0/gst/audio',
            'include/gstreamer-1.0/gst/fft',
            'include/gstreamer-1.0/gst/pbutils',
            'include/gstreamer-1.0/gst/riff',
            'include/gstreamer-1.0/gst/rtp',
            'include/gstreamer-1.0/gst/rtsp',
            'include/gstreamer-1.0/gst/sdp',
            'include/gstreamer-1.0/gst/tag',
            'include/gstreamer-1.0/gst/video',
            'lib/pkgconfig/gstreamer-allocators-1.0.pc',
            'lib/pkgconfig/gstreamer-app-1.0.pc',
            'lib/pkgconfig/gstreamer-audio-1.0.pc',
            'lib/pkgconfig/gstreamer-fft-1.0.pc',
            'lib/pkgconfig/gstreamer-pbutils-1.0.pc',
            'lib/pkgconfig/gstreamer-riff-1.0.pc',
            'lib/pkgconfig/gstreamer-rtp-1.0.pc',
            'lib/pkgconfig/gstreamer-rtsp-1.0.pc',
            'lib/pkgconfig/gstreamer-sdp-1.0.pc',
            'lib/pkgconfig/gstreamer-tag-1.0.pc',
            'lib/pkgconfig/gstreamer-video-1.0.pc',
            'lib/pkgconfig/gstreamer-plugins-base-1.0.pc',
    ]

    files_lang = ['gst-plugins-base-1.0']

    files_typelibs = [
        'GstAllocators-1.0',
        'GstApp-1.0',
        'GstFft-1.0',
        'GstPbutils-1.0',
        'GstRiff-1.0',
        'GstRtp-1.0',
        'GstRtsp-1.0',
        'GstSdp-1.0',
        'GstTag-1.0',
        'GstVideo-1.0',
        'GstAudio-1.0'
        ]

    def prepare(self):
        self.append_env['CFLAGS'] = " -Wno-error "
        self.append_env['CXXFLAGS'] = " -Wno-error "
        self.append_env['CPPFLAGS'] = " -Wno-error "
        if self.config.target_platform != Platform.LINUX:
            self.configure_options += '--disable-gtk-doc '

        if self.config.variants.owr_testing:
            self.deps += ['pango']
            self.files_plugins_core += ['lib/gstreamer-1.0/libgstpango%(mext)s']

        self.configure_options += ' --disable-cdparanoia'
        self.configure_options += ' --disable-x --disable-xvideo '
        self.configure_options += ' --disable-alsa'

        if self.config.variants.nodebug:
            self.append_env['CFLAGS'] += ' -DGST_LEVEL_MAX=GST_LEVEL_FIXME'
